import { fliterPermission } from '@/utils/sys.js'
export const apis = {
  list: `/admin/basis/getList?modelCode=MODEL_DEPARTMENT&authCode=FUNCTION_DEPARTMENT_LIST`,
  del: `admin/department/del?authCode=BTN_DEPARTMENT_DEL`,
  add: `admin/department/add?authCode=BTN_DEPARTMENT_ADD`,
  edit: `admin/department/edit?authCode=BTN_DEPARTMENT_EDIT`,
  detail: `admin/basis/detail?modelCode=MODEL_DEPARTMENT&authCode=BTN_DEPARTMENT_DETAIL`,
};

export const configs = {
  listUrl: apis.list,
  pageOn: false, // 开启分页
  searchOn: true, // 开启搜索
  operateOn: true, //开启操作区域
  treeOn: false, // 开启树形
  treePropsOn: true, // 树形开启props
  reserveSelection: true,
};

export const searchs = [
  {
    type: "Input",
    column: "department_name",
    label: "部门名称",
  },
  {
    type: "Select",
    column: "department_state",
    label: "状态",
    dimCode: "DIM_TYPE_STATE"
  }
];

export const pages = {
  pageSize: 20,
  orders: [
    {
      field: "id",
      sort: "desc",
    },
  ],
};
export const columns = [
  { type: "selection" },
  {
    label: "部门名称",
    column: "department_name",
    sortable: "custom",
  },
  {
    label: "部门状态",
    column: "department_state",
    display: "state",
    format: 'dim'
  },
  {
    label: "创建时间",
    column: "ctime",
    format: "datetime",
    display: "text",
    
  },
  {
    label: "更新时间",
    column: "utime",
    format: "datetime",
    display: "text",
    
  },
  {
    label: "操作",
    column: "operate",
    width: "160",
    fixed: "right",
  },
];

export const buttons =  fliterPermission([
  {
    operate: "add",
    text: "新增",
    permission: 'BTN_DEPARTMENT_ADD',
  },
  {
    operate: "deleteAll",
    text: "删除",
    permission: 'BTN_DEPARTMENT_DEL',
    type: 'danger',
  },
])
export const columnButtons = fliterPermission([
  {
    operate: "detail",
    text: "详情",
    permission: 'BTN_DEPARTMENT_DETAIL',
  },
  {
    operate: "edit",
    text: "编辑",
    permission: 'BTN_DEPARTMENT_EDIT',
  },
  {
    operate: "delete",
    text: "删除",
    permission: 'BTN_DEPARTMENT_DEL',
    type: 'danger',
  },
])
